package com.tr.rentcar.controller.home;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.tr.rentcar.model.bean.Employee;
import com.tr.rentcar.model.dao.EmployeeDao;

/**
 * Servlet 更多司机
 */
@WebServlet("/driver")
public class DriverController extends HttpServlet {
	private static final long serialVersionUID = 1L;
	EmployeeDao ed=new EmployeeDao();
   
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String id=request.getParameter("eid");
		Integer eid=Integer.parseInt(id);
		Employee emp;
		try {
			//司机详细信息（单条信息）
			emp = ed.findById(eid);
			request.setAttribute("emp", emp);
			//司机姓名
			List<Employee> elist=ed.findAll();
			request.setAttribute("elist", elist);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		request.getRequestDispatcher("WEB-INF/jsp/driver.jsp").forward(request, response);
	}

}
